﻿using System;
using System.Collections.Generic;

namespace VisionCloud.Utility.Extensions
{
    /// <summary>
    /// 自定义排序
    /// </summary>
    public class BlmStringComparer : IComparer<string>
    {
        public int Compare(string x, string y)
        {
            if (x == null && y == null)
                return 0;
            if (x == null)
                return -1;
            if (y == null)
                return 1;

            if (x.Length > y.Length)
                return 1;
            if (y.Length > x.Length)
                return -1;

            return string.Compare(x, y, StringComparison.OrdinalIgnoreCase);
        }
    }
}
